package org.ourgrid.worker.communication.sender;

import org.ourgrid.common.interfaces.WorkerSpecListener;
import org.ourgrid.common.internal.SenderIF;
import org.ourgrid.worker.business.dao.WorkerDAOFactory;
import org.ourgrid.worker.response.UpdateWorkerSpecListenerResponseTO;

import br.edu.ufcg.lsd.commune.container.servicemanager.ServiceManager;

public class UpdateWorkerSpecListenerSender implements SenderIF<UpdateWorkerSpecListenerResponseTO> {

	public void execute(UpdateWorkerSpecListenerResponseTO response, ServiceManager manager) {
		WorkerSpecListener peerWorkerSpecListener = WorkerDAOFactory.getInstance().getWorkerSpecListenerDAO().getPeerWorkerSpecListener();
		
		if (peerWorkerSpecListener != null) {
			peerWorkerSpecListener.updateWorkerSpec(response.getWorkerSpec());
		}
	}

}
